import org.apache.log4j.PropertyConfigurator;
import org.menacheri.jetserver.server.ServerManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;

public class BananaGameServer {
	private static final Logger LOG = LoggerFactory.getLogger(BananaGameServer.class);

	public static void main(String[] args) {
		PropertyConfigurator.configure(System.getProperty("log4j.configuration"));
		AbstractApplicationContext context = new AnnotationConfigApplicationContext(JetServerSpringConfig.class);
		context.registerShutdownHook();
		ServerManager serverManager = context.getBean(ServerManager.class);
		try {
			serverManager.startServers();
		} catch (Exception e) {
			LOG.error("Unable to start servers cleanly: {}",e);
		}
		System.out.println("Started servers");
	}

}
